package org.xxforest.game.core.scenes.scene2d.events.type;

import org.xxforest.game.core.scenes.scene2d.XXNode;
import org.xxforest.game.core.scenes.scene2d.XXScreen;
import org.xxforest.game.core.scenes.scene2d.events.XXEvent;
import org.xxforest.game.core.scenes.scene2d.events.XXEventType;
import org.xxforest.game.core.utils.XXPoint;

import com.badlogic.gdx.utils.Pools;

public class XXScrolledEvent implements XXEvent{

	private float x ,y ;
	private XXScreen screen ;
	private XXNode node ;
	private int amount ;
	
	public static XXScrolledEvent create(){
		return Pools.obtain(XXScrolledEvent.class);
	}
	
	public XXScrolledEvent scroll(XXNode node , int amount){
		this.node = node ;
		this.amount = amount ;
		return this ;
	}
	
	public XXScrolledEvent point(float x ,float y){
		this.x = x ;
		this.y = y ;
		return this ;
	}
	
	public XXScrolledEvent screen(XXScreen screen){
		this.screen = screen ;
		return this ;
	}

	public XXEventType getEventType() {
		return XXEventType.SCROLLED;
	}

	public float getX() {
		return x;
	}

	public float getY() {
		return y;
	}

	public XXScreen getScreen() {
		return screen;
	}

	public XXNode getNode() {
		return node;
	}

	public int getAmount() {
		return amount;
	}

	public XXPoint getTouchPoint() {
		return XXPoint.create(x, y);
	}

	@Override
	public void dispose() {
		Pools.free(this) ;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("XXScrolledEvent [x=");
		builder.append(x);
		builder.append(", y=");
		builder.append(y);
		builder.append(", screen=");
		builder.append(screen);
		builder.append(", node=");
		builder.append(node);
		builder.append(", amount=");
		builder.append(amount);
		builder.append("]");
		return builder.toString();
	}
	
}
